package main

import (
	"fmt"
	"log"
	"net/rpc"
	"radish/service"
)

func main() {
	c, err := rpc.DialHTTP("tcp", "0.0.0.0:1234")
	if err != nil {
		log.Fatal("Dailing error:", err)
	}
	req := &service.StringRequest{"A", "B"}
	var reply string
	err = c.Call("StringService.Concat", req, &reply)
	if err != nil {
		log.Fatal("Concat error:", err)
	}
	fmt.Printf("reply: %s\n", reply)
	req = &service.StringRequest{"ACD", "BDF"}
	call := c.Go("StringService.Diff", req, &reply, nil)
	_ = <-call.Done
	fmt.Printf("StringService Diff reply: %s\n", reply)
}
